Imports System.Data.Objects

Public Class PediatraAsindoRepository
    Inherits BaseEntityRepository(Of PediatraAsindo, Persona)

    Private oSets() As ObjectSet(Of Persona)

    Public Sub New(ByVal context As AsindoContext)
        MyBase.New(context)
        oSets = {context.Personas}
    End Sub

    Public Overrides Function GetID(ByVal obj As PediatraAsindo) As Integer
        Return obj.Id
    End Function

    Protected Overrides Function GetByIdQuery(ByVal qbase As IQueryable(Of PediatraAsindo), ByVal id As Integer) As IQueryable(Of PediatraAsindo)
        Return qbase.Where(Function(r) r.Id = id)
    End Function

    Protected Overrides ReadOnly Property MainObjectSet As ObjectSet(Of Persona)
        Get
            Return Context.Personas
        End Get
    End Property

    Protected Overrides ReadOnly Property ObjectSets As ICollection(Of ObjectSet(Of Persona))
        Get
            Return oSets
        End Get
    End Property

    Public Function Desplegable() As List(Of PediatraAsindo)
        Return All.OrderBy(Function(ped) ped.Apellido1).ThenBy(Function(ped) ped.Apellido2).ThenBy(Function(ped) ped.Nombre).ToList
    End Function

    Public Overrides Function CreateDetached() As PediatraAsindo
        Return New PediatraAsindo With {.Activo = True}
    End Function
End Class
